import Index from '../layout/Index.vue'

export const asyncRouters = {
  path: '/',
  component: Index,
  redirect: '/dashboard',
  children: [
    // {
    //   path: '/index',
    //   component: Index,
    //   redirect: '/dashboard'
    // },
    // 后台首页
    {
      path: '/dashboard',
      component: () =>
        import(
          /* webpackChunkName: "dashboard" */ '../views/dashboard/Dashboard.vue'
        ),
      meta: {
        role: ['super', 'normal'],
        title: '后台首页',
        icon: 'icon-shouye'
      }
    },

    // 订单
    {
      path: '/order',
      component: () =>
        import(
          /* webpackChunkName: "ordermanage" */ '../views/order/OrderManage.vue'
        ),
      meta: {
        title: '订单管理',
        role: ['super', 'normal'],
        icon: 'icon-icon-'
      }
      // hidden: true
    },

    // 商铺管理
    {
      path: '/stroe',
      component: () =>
        import(
          /* webpackChunkName: "storemanage" */ '../views/store/StoreManage.vue'
        ),
      meta: {
        title: '商铺管理',
        role: ['super'],
        icon: 'icon-dianpu'
      }
    },
    // 商品管理
    {
      path: '/goods',
      component: () =>
        import(/* webpackChunkName: "goodsindex" */ '../views/goods/Index.vue'),
      meta: {
        title: '商品管理',
        role: ['super', 'normal'],
        icon: 'icon-shangpin'
      },
      redirect: '/goods/list',
      children: [
        {
          path: '/goods/list',
          component: () =>
            import(
              /* webpackChunkName: "goodslist" */ '../views/goods/GoodsList.vue'
            ),
          meta: {
            title: '商品列表'
          }
        },
        {
          path: '/goods/add',
          component: () =>
            import(
              /* webpackChunkName: "goodsadd" */ '../views/goods/GoodsAdd.vue'
            ),
          meta: {
            title: '商品添加'
          }
        },

        {
          path: '/goods/cate',
          component: () =>
            import(
              /* webpackChunkName: "goodscategory" */ '../views/goods/GoodsCategory.vue'
            ),
          meta: {
            title: '商品分类'
          }
        }
      ]
    },

    // 用户管理

    {
      path: '/user',
      component: () =>
        import(/* webpackChunkName: "userindex" */ '../views/user/Index.vue'),
      redirect: '/user/list',
      meta: {
        title: '用户管理',
        role: ['super', 'normal'],
        icon: 'icon-zhanghao'
      },

      children: [
        {
          path: '/user/list',
          name: '用户列表',
          component: () =>
            import(
              /* webpackChunkName: "userlist" */ '../views/user/UserList.vue'
            ),
          meta: {
            title: '用户列表',
            role: ['super']
          }
        },
        {
          path: '/user/add',
          component: () =>
            import(
              /* webpackChunkName: "useradd" */ '../views/user/UserAdd.vue'
            ),
          meta: {
            title: '用户添加',
            role: ['super']
          }
        },
        {
          path: '/user/update',
          component: () =>
            import(
              /* webpackChunkName: "userupdate" */ '../views/user/UserUpdate.vue'
            ),
          meta: {
            title: '用户修改'
          }
        }
        // {
        //   path: '/user/info',
        //   component: () =>
        //     import(
        //       /* webpackChunkName: "userupdate" */ '../views/user/UserInfo.vue'
        //     ),
        //   meta: {
        //     title: '个人中心',
        //     role: ['super', 'normal']
        //   },
        //   hidden: true
        // }
      ]
    },

    // 销售统计
    {
      path: '/sell',
      component: () =>
        import(
          /* webpackChunkName: "storeindex" */ '../views/sellstat/Index.vue'
        ),
      redirect: '/sell/goods',
      meta: {
        title: '销售管理',
        role: ['super'],
        icon: 'icon-tongji'
      },

      children: [
        {
          path: '/sell/goods',
          component: () =>
            import(
              /* webpackChunkName: "storemanage" */ '../views/sellstat/GoodsStat.vue'
            ),
          meta: {
            title: '销售商品'
          }
        },
        {
          path: '/sell/order',
          component: () =>
            import(
              /* webpackChunkName: "orderstat" */ '../views/sellstat/OrderStat.vue'
            ),
          meta: {
            title: '销售订单'
          }
        }
      ]
    },

    // 个人中心
    {
      path: '/user/info',
      component: () =>
        import(
          /* webpackChunkName: "userupdate" */ '../views/user/UserInfo.vue'
        ),
      meta: {
        title: '个人中心',
        role: ['super', 'normal']
      },
      hidden: true
    }
  ]
}

// 登录
